﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace GiveGraphModel
{



    public class Schedule
    {
        public int ScheduleId { get; set; }

        protected virtual string _dayOfWeek { get; set; }

        public virtual DateTime StartTime { get; set; }

        public virtual DateTime EndTime { get; set; }

        public DayOfWeek? DayOfWeek
        {
            get
            {
                if (_dayOfWeek == null)
                    return null;
                return (DayOfWeek)Enum.Parse(typeof (DayOfWeek), _dayOfWeek);
            }
            set { _dayOfWeek = value.ToString(); }
        }
    }

    public sealed class ScheduleConfiguration : EntityTypeConfiguration<Schedule>
    {
        public ScheduleConfiguration()
        {
            
            Ignore(m=>m.DayOfWeek);
            Property(s => s.StartTime).IsRequired();
            Property(s => s.EndTime).IsRequired();
        }
    }
}
